package elm;

import elm.pojo.Admin;
import elm.view.AdminView;
import elm.view.BusinessView;
import elm.view.impl.AdminViewImpl;
import elm.view.impl.BusinessViewImpl;

import java.util.Scanner;

public class ElmAdminEntry {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("=====================================================");
        System.out.println("|\t\t\t\t\t饿了么后台管理系统\t\t\t\t\t|");
        System.out.println("=====================================================");

        AdminView adminView = new AdminViewImpl();
        Admin admin = adminView.login();

        BusinessView businessView = new BusinessViewImpl();
        if (admin != null) {
            int menu = 0;
            while (menu != 5) {
                System.out.println("\n=====1.所有商家列表==2.搜索商家==3.新建商家==4.删除商家==5.退出系统");
                System.out.println("请输入你的选择：");
                menu = input.nextInt();
                switch (menu) {
                    case 1:
                        businessView.listBusinessAll();
                        break;
                    case 2:
                        businessView.listBusiness();
                        break;
                    case 3:
                        businessView.saveBusiness();
                        break;
                    case 4:
                        businessView.deleteBusiness();
                        break;
                    case 5:
                        System.out.println("------------欢迎下次光临饿了么后台管理系统------------");
                        break;
                    default:
                        System.out.println("没有这个选项！！\n");
                        break;
                }
            }
        }
    }
}
